package com.apex.sdk.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;

public class SharedData {
    static final String SharedName = "test_shared";

    public static String getMacAddress(Context mContext) {
        if (mContext == null) {
            throw new NullPointerException();
        }
        SharedPreferences sharedPreferences = mContext.getSharedPreferences(SharedName, Context.MODE_PRIVATE);
        return sharedPreferences.getString("bleMac", null);
    }

    public static void saveMacAddress(Context mContext, String mac) {
        if (mContext == null) {
            throw new NullPointerException();
        }
        if (TextUtils.isEmpty(mac)) {
            return;
        }
        SharedPreferences sharedPreferences = mContext.getSharedPreferences(SharedName, Context.MODE_PRIVATE);
        sharedPreferences.edit().putString("bleMac", mac).commit();
    }

}
